<?php
$tm = $_GET['tm'];
$da = json_decode($tm,true);
$data=array('csm'=>"📍 我的人格小瓶子",'dfjs'=>"评测得分：",'df'=>null,'bq1' =>"事业心😬",'bq2'=>"头脑😆",'bq3'=>"佛系😇",'bq4'=>"耿直🙃",'bq5'=>"体贴😃",'bq6' =>"多疑🧐",'bq7'=>"情商🤪",'bq8'=>"责任心🤔",'bq9'=>"乐观🤓",'bq10'=>"渣🤩",'bq11'=>"同性恋😎",'bq12'=>"异性恋🤤",'pf1' =>3,'pf2'=>4,'pf3'=>3,'pf4'=>3,'pf5'=>3,'pf6' =>2,'pf7'=>3,'pf8'=>null,'pf9'=>3,'pf10'=>2,'pf11'=>1,'pf12'=>5);
$df = 0;
for($i=0; $i<4; $i++){
   switch ($i){
       case 0: switch($da[0])
                    {case A: $df=10; $data[pf9]=2; $data[pf6]=4;break;
                     case B: $df=20; $data[pf9]=4; $data[pf2]=5;$data[pf6]=1;break;
                     case C: $df=15; $data[pf9]=5; $data[pf2]=4;break;
                     }break;
       case 1:switch($da[1])
                    {case A: $df=$df+15; $data[pf8]=2; $data[pf4]=1; $data[pf10]=3;break;
                     case B: $df=$df+10; $data[pf8]=2; $data[pf4]=1; $data[pf10]=4;break;
                     case C: $df=$df+10; $data[pf8]=1; $data[pf4]=2; $data[pf1]=3;$data[pf10]=4;break;
                     case D: $df=$df+20; $data[pf8]=4; $data[pf4]=5;$data[pf10]=1; break;
                     }break;
       case 2:switch($da[2])
                    {case A: $df=$df+10;  $data[pf7]=3; $data[pf5]=5;break;
                     case B: $df=$df+20;  $data[pf7]=5; $data[pf5]=2; $data[pf1]=5;break;
                     case C: $df=$df+15;  $data[pf7]=4; $data[pf5]=4;break;
                     }break;
       case 3:switch($da[3])
                    {case A: $df=$df+20; $data[pf3]=4; $data[pf11]=1; break;
                     case B: $df=$df+15; $data[pf3]=2; $data[pf11]=1;break;
                     case C: $df=$df+10; $data[pf3]=1; $data[pf11]=2; break;
                     }break;
   }
}
$data[df]=$df;
echo json_encode($data,JSON_UNESCAPED_UNICODE);
$conn = new mysqli('127.0.0.1', '3h74cu729i222', 'gm666946','3h74cu729i222');
$conn ->set_charset("utf8");
$sql = "SELECT * FROM sjtj WHERE num = 0";
$res=$conn->query($sql);
$data=$res->fetch_all();
$sccs=$data[0][5]+1;
$sql = "UPDATE sjtj SET xpzcscs = '$sccs' WHERE num = 0";
$res=$conn->query($sql);
$conn->close();
?>